<?php
namespace app\superadmin\validate;

use think\Validate;

class Shopadmins extends Validate
{
    // protected $rule = [
    //     'adminname'  =>  'require|max:10',
    //     'adminname'  =>  'unique:shopadmins',
    //     'phone'  =>  'require|min:11',
    //     'phone'  =>  'unique:shopadmins',
    //     //'adminpass'  =>  'require|min:5',
    // ];

    // protected $message = [
    //     'adminname.require'  =>  '管理员名不能为空！',
    //     'adminname.unique'  =>  '管理员名不能重复！',
    //     'adminname.max'  =>  '管理员名不能大于10位！',
    //     'phone.require'  =>  '手机号不能为空！',
    //     'phone.unique'  =>  '手机号不能重复！',
    //     'phone.min'  =>  '请填写正确的手机号！',

    //     //'adminpass.min'  =>  '密码不能少于5位！',
        
    // ];


    protected $rule = [
        'adminname'  =>  'require|unique:shopadmins',
        'phone' => 'require|length:11|number|unique:shopadmins',
        'adminpass' => 'require',
    ];
    protected $message = [
        'adminname.require'  =>  '管理员名不能为空！',
        'adminname.unique'  =>  '管理员名不能重复！',
        'phone.require'  => '手机号不能为空！',
        'phone.number'  => '手机号格式错误！',
        'phone.length'  => '手机号格式错误！',
        'phone.unique'  => '手机号已经存在！',
        'adminpass.require'  =>'密码不能为空！',
        //'adminpass.password' =>'密码格式6-15个字母数字组合！',
    ];
    protected $regex = [
        'phone'    => '/^1[2|4|5|8]\d{9}$/',
        //'adminpass'  => "/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,20}$/",
    ];

}




?>